package com.mbl.base.modular.mall.controller;


import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.mbl.base.core.utils.UtilSecurity;
import com.mbl.base.modular.mall.entity.IntegralGoodUser;
import com.mbl.base.modular.mall.service.IIntegralGoodUserService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;
import com.mbl.base.core.common.controller.BaseController;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author lwj
 * @since 2020-04-23
 */
@RestController
@RequestMapping("/mall/integral-good-user")
public class IntegralGoodUserController extends BaseController<IntegralGoodUser, IIntegralGoodUserService> {

    @Override
    public void machiningList(QueryWrapper<IntegralGoodUser> queryWrapper, String condition) {
        if(StringUtils.isNotBlank(condition)){
            final JSONObject jsonObject = JSON.parseObject(condition);
            final String isMy = jsonObject.getString("isMy");
            if("true".equals(isMy)){
                queryWrapper.eq("user_id", UtilSecurity.getUser().getId());
            }
        }
        super.machiningList(queryWrapper, condition);
    }

    @Override
    public void machiningListResult(IPage<IntegralGoodUser> page1) {
        super.machiningListResult(page1);
    }
}

